﻿namespace SEIPropertyDataService.Entity.ViewModels
{
    /// <summary>
    /// 通用请求参数-带验证码
    /// </summary>
    public class VM_PubRequestWithVerifyCode
    {
        /// <summary>
        /// 业务数据
        /// </summary>
        public string Data { get; set; }
        /// <summary>
        /// 验证码
        /// </summary>
        public string VerifyCode { get; set; }
        /// <summary>
        /// 参数，当前时间rsa加密结果
        /// </summary>
        public string Parameter { get; set; }

        /// <summary>
        /// 是否允许Data为空值
        /// </summary>
        [System.Text.Json.Serialization.JsonIgnore]
        public bool IsDataCanNull { get; set; } = false;
        /// <summary>
        /// 是否允许VerifyCode为空值
        /// </summary>
        [System.Text.Json.Serialization.JsonIgnore]
        public bool IsVerifyCodeCanNull { get; set; } = false;
        /// <summary>
        /// 是否包含空值
        /// </summary>
        /// <returns></returns>
        public bool ContainNullValue()
        {
            if ((IsDataCanNull == false && string.IsNullOrWhiteSpace(Data)) || (IsVerifyCodeCanNull == false && string.IsNullOrWhiteSpace(VerifyCode)) || string.IsNullOrWhiteSpace(Parameter))
                return true;
            return false;
        }
    }
}
